package com.zslibrary.Protocol;

import com.zslibrary.Enum.StateDefine;
import com.zslibrary.Enum.StateEventDefine;
import com.zslibrary.Pipe.Pipe;
import com.zslibrary.StateHandle.StateHandle;
import com.zslibrary.Tools.ZSLog;

public class NFCIdleState extends StateHandle {
    private Pipe mPipe;

    public NFCIdleState(Pipe pipe){
        this.mPipe=pipe;
    }

    @Override
    public @StateDefine.State int getNextHop(@StateEventDefine.StateEvent int event) {
        if(event== StateEventDefine.EVT_NONE)
            return StateDefine.STATE_IDLE;
        else if(event==StateEventDefine.EVT_RESET)
            return StateDefine.STATE_INIT;
        else if(event==StateEventDefine.EVT_EXECUTE)
            return StateDefine.STATE_BUSY;
        else if(event==StateEventDefine.EVT_DISCONNECT)
            return StateDefine.STATE_ERROR;
        return StateDefine.STATE_IDLE;
    }

    @Override
    public @StateEventDefine.StateEvent int handle(){
//        ZSLog.d("idle state");
        return Poll.NFCPoll(mPipe);
    }
}
